<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>在线支付</title>

    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <link rel="stylesheet" href="bitStyle/skin/main.css">
    <script src="bitStyle/skin/jquery-1.10.2.min.js"></script>
    <script src="bitStyle/skin/layer.js"></script>
    <link rel="stylesheet" href="bitStyle/skin/layer.css" id="layui_layer_skinlayercss" style="">
    <script src="bitStyle/skin/foundation.js"></script>
    <script src="bitStyle/skin/my.js"></script>
    <script>
    var resultData;
    $(document).ready(function () {
        $('#radio').on('click', 'li', function () {
           // $(this).toggleClass('sel').siblings().removeClass('sel');
            $("li").removeClass('sel');
            $(this).addClass('sel');
        });
        $("input[name='paytype']").on('click', function () {
            // $(this).toggleClass('sel').siblings().removeClass('sel');
            var paytype =  $("input[name='paytype']:checked").val();
            if(paytype == 1){
                $(".payway").fadeOut(1000);
            }else{
                $(".payway").fadeIn(1000);
            }
        });
    });


   //创建订单
    function CreateOrder() {
        var PaymentMethod =  $("input[name='paytype']:checked").val();
        if (PaymentMethod == 2) {
            //在线支付 跳转在线支付方法
            CreateOrderOnlinePay();
            return;
        }

        var pay_num = $("input[name='pay_num']:checked").val();
        //alert(pay_num);
        //if(PaymentMethod == "余额") {
            var balance = parseFloat('3');
            if (balance < $("input[name='pay_num']:checked").attr('pay_money')) {
                layer.msg("账户余额不足");
                return;
            }
        //}
        var i = layer.load(2);
        //创建订单
        var param = {
            zffs3: 1,//微信支付 确认
            zffs2: 1,//微信支付 确认
            zffs1: 1,//微信支付 确认
            pay_type: 1,//场次选择 20元 40元 60元
            pay_money:$("input[name='pay_num']:checked").attr('pay_money'),
            amount: pay_num
        };
        $.post("/home/rmq/tgbzcl.html", param, function (data) {
                layer.close(i);
                //alert(JSON.stringify(data));
                if (data.Code == 200) {
                    layer.msg(data.Message, function () {
                        window.location.href = '/home/rmq/friends/id/1.html';
                    });
                } else {
                    layer.msg(data.Message, function () {
                        //window.location.href = '/Home/Rmq/join.html';
                    });
                }
        }, "json");
    }
    //在线支付
    function CreateOrderOnlinePay() {
        var PaymentMethod =  $("input[name='paytype']:checked").val();//1 余额支付 2在线支付
        if (PaymentMethod == 1) {  //在线支付 跳转在线支付方法
            CreateOrder();
            return;
        }
        var Payway =  $("input[name='payway']:checked").val();//1 支付宝 2 微信

        var i = layer.load(2);
        //创建订单
        var param = {
            price: $("input[name='pay_num']:checked").attr('pay_money'),//支付金额
            istype: Payway,//支付方式微信支付 确认
        };
        $.post('CreateOrderOnlinePay', param, function (data) {
            //layer.close(i);
            if (data.code > 0) {

                $("#goodsname").val(data.data.goodsname);
                $("#istype").val(data.data.istype);
                $('#key').val(data.data.key);
                $('#notify_url').val(data.data.notify_url);
                $('#orderid').val(data.data.orderid);
                $('#orderuid').val(data.data.orderuid);
                $('#price').val(data.data.price);
                $('#return_url').val(data.data.return_url);
                $('#uid').val(data.data.uid);
                $('#submitdemo1').click();
               // layer.close(i);
            } else {
                layer.close(i);
                layer.msg(data.msg);
            }
        }, "json");

    }
    </script>
<style>
    #pay1,#pay2,#pay3{width: 0;height: 0;}
    .paytypechoice{width: 100%;line-height: 2rem;height: 2rem;background-color: #ffffff;margin: 0.6rem auto; text-align: right;}
    .paytypechoice label{width: 40%; display:inline-block;float: left; padding-right: 5%;line-height: 2rem;height: 2rem;}
    .payway{display: none;}
</style>
</head>
<body style="">


<div class="wrapper">
    <div class="back-eee"></div>
    <script>
    function back(){
        window.history.back();
    }
</script>
<style>
    .wrapper .mystyle{background-color:#6AA84F;text-align: center;font-weight: bold; color: #ffffff;
        padding: .4rem 3%; width: 94%; }
    .wrapper .mystyle img{float: left;  height: 100%; }
    .wrapper .notice,.article ,.joinfb,.w33,.my-friend001,.ljjcjj,.pt20,.swiper-container,.myforget,.myreg{margin-top: 1.8rem;}

    .weixin-set,.ewm{margin-top: 2.6rem;}
    .my-money001{margin-top: 2.2rem;}

</style>
<div class="header mystyle"><img onclick="back();" src="bitStyle/skin/back.png">人脉圈</div>

    <div class="book-pay">
        <div class="bp-top joinfb" style="margin-bottom: .6rem;">
            <span class="money">￥3</span>
            <span class="status">账户余额</span>
        </div>
        <div class="paytypechoice">
            <label for="paytype1" param="1">余额支付
                <input type="radio"  id="paytype1" name="paytype"  checked value="1"></label>
            <label for="paytype2" param="2">在线支付
                <input type="radio"  id="paytype2" name="paytype"  value="2"></label>
        </div>
        <div class="paytypechoice payway">
            <label for="payway1">支付宝
                <input type="radio"  id="payway1" name="payway"  checked value="1"></label>
            <label for="payway2">微信
                <input type="radio"  id="payway2" name="payway"  value="2"></label>
        </div>
        <ul class="pay-type" id="radio">
            <label for="pay1"><li param="余额" class="sel">

                <i class="pay pay1">每轮:￥<span>20</span></i>
                <input type="radio"  id="pay1" name="pay_num" pay_money="20"  checked value="100">
            </li></label>
            <label for="pay2"><li param="余额" class="">

                <i class="pay pay1">每轮:￥<span>40</span></i>
                <input type="radio" id="pay2" name="pay_num" pay_money="40" value="200">
            </li></label>
                <label for="pay3"><li param="余额" class="">

                <i class="pay pay1">每轮:￥<span>60</span></i>
                <input type="radio" id="pay3" name="pay_num" pay_money="60" value="300">
            </li></label>
        </ul>
        <a href="javascript:CreateOrder();"><input class="submit-f-btn mt20" type="button" value="确认支付"></a>
    </div>
</div>
<form style='display: none' id='formpay' name='formpay' method='post' action='https://pay.paysapi.com'>
    <input name='goodsname' id='goodsname' type='text' value='' />
    <input name='istype' id='istype' type='text' value='' />
    <input name='key' id='key' type='text' value=''/>
    <input name='notify_url' id='notify_url' type='text' value=''/>
    <input name='orderid' id='orderid' type='text' value=''/>
    <input name='orderuid' id='orderuid' type='text' value=''/>
    <input name='price' id='price' type='text' value=''/>
    <input name='return_url' id='return_url' type='text' value=''/>
    <input name='uid' id='uid' type='text' value=''/>
    <input type='submit' id='submitdemo1'>
</form>




</body></html>